// ********************************************************************************************
// Este archivo fuente es propiedad de Feria de Remates S.R.L. de C.V. Prohibida su copia o uso
// sin autorización explícita.
// This source file is propietary to Feria de Remates S.R.L. de C.V. May not be used or copied
// without explicit authorization.
// ********************************************************************************************/
package com.feriaderemates.domain.userAccount;

/**
 * Represents a user in the system.
 *
 * @author Oscar Garcia
 */
public class User {

    private String firstName;
    private String lastName;
    private String email;
    private String cellPhone;
    private String secondLastName;
    private String username;
    private UserAccountType accountType;
    private UserAccountStatus userAccountStatus;
    private String hashedPassword;
    private State state;
    private final Integer userId;

   
    
    
    /**
     * Creates a user with the fields that are saved in the database
     * 
     * @param userId
     * @param firstName
     * @param lastName
     * @param secondLastName
     * @param username
     * @param email
     * @param password
     * @param userAccountType
     * @param userAccountStatus
     * @return 
     */
    public static User createUserFromDb(int userId, String firstName, String lastName, String secondLastName, String username, String email, String password,
            UserAccountType userAccountType, UserAccountStatus userAccountStatus) {
        return new User(userId, firstName, lastName, secondLastName, username, email, password, userAccountType, userAccountStatus);
    }

    /**
     * Class constructor
     * 
     * @param firstName
     * @param lastName
     * @param secondLastName
     * @param username
     * @param email
     * @param password 
     */
    private User(String firstName, String lastName, String secondLastName, String username, String email, String password) {
        this.userId = null;
        this.firstName = firstName;
        this.lastName = lastName;
        this.secondLastName = secondLastName;
        this.username = username;
        this.email = email;
        this.hashedPassword = password;
    }

    /**
     * Creates a user instance with the required fields to be registered
     * 
     * @param firstName
     * @param lastName
     * @param secondLastName
     * @param username
     * @param email
     * @param password
     * @param userAccountType
     * @param userAccountStatus
     * @return 
     */
    public static User createUserToRegister(String firstName, String lastName, String secondLastName, String username, String email, String password) {

        return new User(firstName, lastName, secondLastName, username, email, password);
    }

    /**
     * Class constructor
     * 
     * @param userId
     * @param firstName
     * @param lastName
     * @param secondLastName
     * @param username
     * @param email
     * @param password
     * @param userAccountType
     * @param userAccountStatus 
     */
    private User(int userId, String firstName, String lastName, String secondLastName, String username, String email, String password, UserAccountType userAccountType,
            UserAccountStatus userAccountStatus) {
        this.userId = userId;
        this.firstName = firstName;
        this.lastName = lastName;
        this.secondLastName = secondLastName;
        this.username = username;
        this.email = email;
        this.hashedPassword = password;
        this.accountType = userAccountType;
        this.userAccountStatus = userAccountStatus;

    }
    
    
    
     public User(int userId, String firstName) {
        this.userId = userId;
        this.firstName = firstName;
        
       

    }

    /**
     * @return the firstName
     */
    public String getFirstName() {
        return firstName;
    }

    /**
     * @param firstName the firstName to set
     */
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    /**
     * @return the lastName
     */
    public String getLastName() {
        return lastName;
    }

    /**
     * @param lastName the lastName to set
     */
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the celPhone
     */
    public String getCellPhone() {
        return cellPhone;
    }

    /**
     * @param celPhone the celPhone to set
     */
    public void setCellPhone(String celPhone) {
        this.cellPhone = celPhone;
    }

    /**
     * @return the secondLastName
     */
    public String getSecondLastName() {
        return secondLastName;
    }

    /**
     * @param secondLastName the secondLastName to set
     */
    public void setSecondLastName(String secondLastName) {
        this.secondLastName = secondLastName;
    }

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }

    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return the accountType
     */
    public UserAccountType getAccountType() {
        return accountType;
    }

    /**
     * @param accountType the accountType to set
     */
    public void setAccountType(UserAccountType accountType) {
        this.accountType = accountType;
    }

    /**
     * @return the userAccountStatus
     */
    public UserAccountStatus getUserAccountStatus() {
        return userAccountStatus;
    }

    /**
     * @param userAccountStatus the userAccountStatus to set
     */
    public void setUserAccountStatus(UserAccountStatus userAccountStatus) {
        this.userAccountStatus = userAccountStatus;
    }

    /**
     * @return the hashedPassword
     */
    public String getHashedPassword() {
        return hashedPassword;
    }

    /**
     * @param hashedPassword the hashedPassword to set
     */
    public void setHashedPassword(String hashedPassword) {
        this.hashedPassword = hashedPassword;
    }

    /**
     * @return the state
     */
    public State getState() {
        return state;
    }

    /**
     * @param state the state to set
     */
    public void setState(State state) {
        this.state = state;
    }

    /**
     * @return the userId
     */
    public Integer getUserId() {
        return userId;
    }
    

    @Override
    public String toString() {
        return "User{" + "firstName=" + firstName + ", lastName=" + lastName + ", email=" + email + ", cellPhone=" + cellPhone + ", secondLastName=" + secondLastName + ", username=" + username + ", accountType=" + accountType + ", userAccountStatus=" + userAccountStatus + ", hashedPassword=" + hashedPassword + ", state=" + state + ", userId=" + userId + '}';
    }

   
}
